var express = require('express');
var path = require('path');
var favicon = require('static-favicon');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var bodyParser = require('body-parser');
var http = require('http');
var https = require('https');
var fs = require('fs');
var compression = require('compression'); 

var logger = require('./models/logger');
var CONSTS = require('./consts');
/*var filter = require('./filter');*/
var index = require('./routes/index');
var user = require('./routes/user');
/*var vote = require('./routes/vote');
var license = require('./routes/license');
var classify = require('./routes/classify');
var classification = require('./routes/classification');
var comment = require('./routes/comment');
var course = require('./routes/course');
var equipment = require('./routes/equipment');
var software = require('./routes/software');
var xls = require('./routes/xls');
var event = require('./routes/event');*/




var app = express();
app.use(bodyParser.json({
	limit: '200mb'
}));
app.use(bodyParser.urlencoded({
	limit: '200mb',
	extended: true
})); 

app.use(compression());  
app.use(cookieParser());
app.use('/', index);
app.use('/user', user);


// app.set('port', CONSTS.APP.PORT);
app.use(express.static(path.join(__dirname, CONSTS.APP.STATICPATH)));

app.listen(5000, function() {
	logger.debug(5000);
});

/*https.createServer(options, app).listen(CONSTS.APP.SSLPORT, function () {
    console.log('Https server listening on port ' + CONSTS.APP.SSLPORT);
});*/

process.on('uncaughtException', function (err) {
    logger.debug('uncaughtException:', err);
});
